home *** CD-ROM | disk | FTP | other *** search
/ Amiga Packmags / NewsFlash - Issue 03 (1989)(UGA - 17-Bit Software)[a].zip / NewsFlash - Issue 03 (1989)(UGA - 17-Bit Software)[a].adf / sources / SamplePlay.S < prev   
Text File  |  1988-01-19  |  2KB  |  75 lines

  1. ; Play Sample
  2. ; (C)1989 by Brian Postma
  3. ; J.v.Hartenstraat 51
  4. ; 7576VX Oldenzaal (NL)
  5.  
  6. start:    lea        buffer,a1
  7.     subq.l        #2,d0        ;Command Line Empty
  8.     blt        quit        ;Yes ??
  9. copy:    move.b        (a0)+,(a1)+    ;Copy Commandline
  10.     dbra        d0,copy
  11.     clr.b        (a1)        ;End with 0->filename
  12.     lea        dosname,a1    ;Library Name
  13.     move.l        4,a6        ;Execbase
  14.     jsr        -408(a6)    ;Open Library
  15.     move.l        d0,dosbase
  16.     move.l        dosbase,a6
  17.     move.l        #buffer,d1    ;FileName
  18.     move.l        #2,d2        ;Read
  19.     jsr        -84(a6)        ;GetLock
  20.     move.l        d0,handle    ;LockHandle
  21.     beq        quit        ;File Found ??
  22.     move.l        dosbase,a6
  23.     move.l        #block,d2    ;Fileinfo block
  24.     move.l        handle,d1    ;LockHandle
  25.     jsr        -102(a6)    ;Examine
  26.     beq        quit        ;Error ?
  27.     lea        block,a0
  28.     move.l        124(a0),length    ;Fetch length from fileinfo
  29.     move.l        dosbase,a6
  30.     move.l        handle,d1
  31.     jsr        -90(a6)        ;UnLock
  32.     move.l        4,a6        ;Execbase
  33.     move.l        length,d0    ;Length of file
  34.     move.l        #2,d1        ;ChipMem
  35.     jsr        -198(a6)    ;AllocMem
  36.     move.l        d0,memblock    ;Pointer to memory
  37.     beq        quit        ;Error
  38.     move.l        dosbase,a6
  39.     move.l        #1005,d2    ;Mode=OLDFILE
  40.     move.l        #buffer,d1    ;FileName
  41.     jsr        -30(a6)        ;Open
  42.     move.l        d0,handle    ;FileHandle
  43.     beq        quit2        ;Error ??
  44.     move.l        handle,d1    ;FileHandle
  45.     move.l        length,d3    ;FileLength
  46.     move.l        memblock,d2    ;Buffer
  47.     jsr        -42(a6)        ;Read
  48.     move.l        handle,d1    ;FileHandle
  49.     jsr        -36(a6)        ;Close
  50.     move.l        memblock,$dff0a0;Pointer to Sample
  51.     move.l        length,d0    ;Length
  52.     lsr.l        #1,d0        ;Divide by 2->Length in Words
  53.     move.w        d0,$dff0a4    ;Length Sample in words
  54.     move.w        #$1ac,$dff0a6    ;Replay Rate
  55.     move.w        #64,$dff0a8    ;Volume
  56.     move.w        #$8001,$dff096    ;Audio DMA for Voice1 on
  57. wait:    btst        #6,$bfe001    ;MouseButton Pressed
  58.     bne        wait        ;No ??
  59.     move.w        #$1,$dff096    ;Audio DMA for Voice1 off
  60. quit2:    move.l        memblock,a1    ;Memory Pointer
  61.     move.l        length,d0    ;Length in bytes
  62.     move.l        4,a6        ;Execbase
  63.     jsr        -210(a6)    ;Freemem
  64. quit:    clr.l        d0
  65.     rts
  66. ; Some Vars
  67. dosbase:dc.l        0
  68. length:    dc.l        0        ;FileLength
  69. handle:    dc.l        0        ;FileHandle
  70. memblock:dc.l        0
  71. buffer:    blk.b        128,0        ;Command Line Buffer
  72. block:    blk.b        256,0        ;FileInfoBlock buffer
  73. dosname:dc.b        "dos.library",0    ;Name of doslibrary
  74.  
  75.